package concurrency.chapter2;

public class TaxCalculatorMain {
    public static void main(String[] args) {
        /*TaxCalculator calaculator = new TaxCalculator(10000d, 2000d) {
            @Override
            protected double calcTax() {
                return getSalary() * 0.1 + getBonus() * 0.15;
            }
        };
        double tax = calaculator.calculate();
        System.out.println(tax);*/

        //策略模式
        /*TaxCalculator calculator = new TaxCalculator(10000d, 2000d);
        CalculatorStraregy straregy = new SimpleCalculatorStrategy();
        calculator.setCalculatorStraregy(straregy);
        System.out.println(calculator.calculate());*/

        TaxCalculator calculator = new TaxCalculator(10000d, 2000d,(s, b) -> s * 0.1 + b * 0.15);
        System.out.println(calculator.calculate());
    }
}
